/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package mywebapp.webpage.impl;

import mywebapp.webpage.Balise;
import mywebapp.webpage.Td;
import mywebapp.webpage.WebpagePackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Td</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mywebapp.webpage.impl.TdImpl#getBalise <em>Balise</em>}</li>
 *   <li>{@link mywebapp.webpage.impl.TdImpl#getTh <em>Th</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TdImpl extends EObjectImpl implements Td {
	/**
	 * The cached value of the '{@link #getBalise() <em>Balise</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBalise()
	 * @generated
	 * @ordered
	 */
	protected Balise balise;

	/**
	 * The default value of the '{@link #getTh() <em>Th</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTh()
	 * @generated
	 * @ordered
	 */
	protected static final String TH_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTh() <em>Th</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTh()
	 * @generated
	 * @ordered
	 */
	protected String th = TH_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TdImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return WebpagePackage.Literals.TD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getTh() {
		return th;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTh(String newTh) {
		String oldTh = th;
		th = newTh;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.TD__TH, oldTh, th));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Balise getBalise() {
		return balise;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetBalise(Balise newBalise, NotificationChain msgs) {
		Balise oldBalise = balise;
		balise = newBalise;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WebpagePackage.TD__BALISE, oldBalise, newBalise);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBalise(Balise newBalise) {
		if (newBalise != balise) {
			NotificationChain msgs = null;
			if (balise != null)
				msgs = ((InternalEObject)balise).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WebpagePackage.TD__BALISE, null, msgs);
			if (newBalise != null)
				msgs = ((InternalEObject)newBalise).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WebpagePackage.TD__BALISE, null, msgs);
			msgs = basicSetBalise(newBalise, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.TD__BALISE, newBalise, newBalise));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case WebpagePackage.TD__BALISE:
				return basicSetBalise(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WebpagePackage.TD__BALISE:
				return getBalise();
			case WebpagePackage.TD__TH:
				return getTh();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WebpagePackage.TD__BALISE:
				setBalise((Balise)newValue);
				return;
			case WebpagePackage.TD__TH:
				setTh((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case WebpagePackage.TD__BALISE:
				setBalise((Balise)null);
				return;
			case WebpagePackage.TD__TH:
				setTh(TH_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WebpagePackage.TD__BALISE:
				return balise != null;
			case WebpagePackage.TD__TH:
				return TH_EDEFAULT == null ? th != null : !TH_EDEFAULT.equals(th);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (th: ");
		result.append(th);
		result.append(')');
		return result.toString();
	}

} //TdImpl
